import java.util.Arrays;

public class Bke {
    public static void main(String[] args) {
        int arr[][] = {{1, 2, 3}, {4, 5, 6}};
        for (int[] arr1 : arr) {
            for (int x : arr1) {
                System.out.print(x + " ");
            }
            System.out.println();
        }
    }
    public static void main7(String[] args) {
        int arr[][] = {{1, 2, 3}, {4, 5, 6}};
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }
    public static void main6(String[] args) {
        int[] arr = {1, 2, 3, 4, 5, 6};
        int[] arr1 = new int[arr.length];
        arr1 = arr.clone();//arr是你要克隆的数组
        System.out.println(Arrays.toString(arr1));
    }
    public static void main5(String[] args) {
        int [] arr={1,2,3,4,5,6};
        int [] arr1=new int [5];
        System.arraycopy(arr,3,arr1,2,2);
        System.out.println(Arrays.toString(arr1));
    }
    public static void main4(String[] args) {
        int [] arr={1,2,3,4,5,6};
        int [] arr1=new int [arr.length];
        arr1=Arrays.copyOf(arr,arr.length);
        System.out.println(Arrays.toString(arr1));
    }
    public static void fun1(int[] arr) {
        arr = new int[10];
    }

    public static void fun2(int[] arr) {
        arr[0] = 99;
    }

    public static void main3(String[] args) {
        int arr[] = {1, 2, 3, 4, 5};
        int arr1[] = {1, 2, 3, 4, 5};
        fun1(arr);
        System.out.println(Arrays.toString(arr));//1
        //Arrays.toString 将数组用字符串的形式打印出来
        fun2(arr1);
        System.out.println(Arrays.toString(arr1));//2

    }
    public static void main2(String[] args) {
        int [] arr={9,8,7,6,5,4,3,2,1,0};
        for (int i = 0; i <arr.length ; i++) {
            //arr.length 计算数组的长度
            System.out.print(arr[i]+" ");
            //println打印自动换行
            //printf("%d",arr[i]),%d是数据类型
        }
        for (int x:arr ){
            System.out.print(x+" ");
        }
    }

    public static void main1(String[] args) {
        int [] arr=new int [10];
        Arrays.fill(arr,1);
    }

}
